import math

(a,b)=(float(x) for x in input().strip().split())

def fun(x):
    return x**3-3*x-1

def fun_diff(x):
    return 3*x**2-3


def newton(x,max_times,error):
    cnt=0
    while 1==1:
        cnt+=1
        new_x = x - fun(x) / fun_diff(x)
        if math.fabs(new_x-x)<error or cnt==max_times:
            break
        x=new_x
        print("%.5f %d" % (x, cnt))
    print("%.5f %d" % (x, cnt))
    return new_x


def fi_1(x,x0):
    return x-(x-x0)*fun(x)/(fun(x)-fun(x0))

def fi_2(x0,x1):
    return x1-fun(x1)*(x1-x0)/(fun(x1)-fun(x0))

def secant_1(x, x0, max_times, error):
    cnt=0
    while 1==1:
        cnt+=1
        new_x = fi_1(x,x0)

        print("%.5f %d" % (new_x, cnt))
        if math.fabs(new_x-x)<error or cnt==max_times:
            break
        x=new_x



    return new_x,cnt

def secant_2(x,last_x,max_times,error):
    cnt=0

    while 1==1:
        cnt+=1
        new_x = fi_2(last_x,x)
        print("%.5f %d" % (new_x, cnt))
        if math.fabs(new_x-x)<error or cnt==max_times:
            break
        last_x=x
        x=new_x


    return new_x

newton(a,500,0.00001)
secant_1(b, a, 500, 0.00001)
secant_2(b,a,500,0.00001)




